package br.unifor.cct.mia.util.serializer;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;

public class Serializer {

	public void serializer(SerializerObjetct object, String path) throws FileNotFoundException, IOException {		
		ObjectOutput out = new ObjectOutputStream(new FileOutputStream(path));
		out.writeObject(object);
		out.close();		
	}
	
	public SerializerObjetct deserializer(String path) throws IOException, ClassNotFoundException {
		File file = new File(path);
        ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
        SerializerObjetct obj = (SerializerObjetct) in.readObject();
        in.close();
		return obj;
	}

}
